<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*"%>
<%@ page import="com.java.common.OpenFlashChart" %>
<%
	String connGroup 	= CmmUtil.nvl(request.getParameter("connGroup"),"0");
	String user_id 		= CmmUtil.nvl(request.getParameter("user_id"),"");
	String yyyymm 		= CmmUtil.nvl(request.getParameter("yyyymm"),"");
	String week 		= CmmUtil.nvl(request.getParameter("week"),"");
	String ent_id 		= CmmUtil.nvl(request.getParameter("ent_id"),"");

	HashMap map = new HashMap();
	HashMap map1 = null;
	ArrayList list = new ArrayList();
	CommonDaoService commonservice = new CommonDaoService("Com0303lp03Dao");
	map.put("yyyymm",yyyymm);
	map.put("week",week);
	map.put("ent_id",ent_id);
	map.put("connGroup",connGroup);
	map.put("user_id",user_id);
	
	list = (ArrayList)commonservice.commonDaoMethod(map);

	ArrayList<String> data = new ArrayList<String>();
	
	ArrayList<String> labels = new ArrayList<String>();
	
	if(list != null){
		if(list.size() > 0){
			map1 = (HashMap)list.get(0);
		}
	}
	
	String week1[] = {"월","화","수","목","금","토","일"};
	String data_value ="";
	for(int i=0; i<map1.size(); i++){
		data_value = "w" + String.valueOf(i);
		labels.add(i,week1[i]);
		data.add(i,CmmUtil.nvl((String)map1.get(data_value),"0"));
	}
	
	//최대 값을 가지고 오는 알고리즘
	int Max_num = 0;
	for(int i=0; i<data.size(); i++){
		for(int j=i; j<data.size(); j++){
			if(Max_num < Integer.parseInt(data.get(j))){
				Max_num = Integer.parseInt(data.get(j));
			}
		}
	}
	
	OpenFlashChart g = new OpenFlashChart();
	g.bar_glass("30","#5E83BF","#424581","",10);
	g.set_y_max(Max_num + 30); //최대값에 따라서 y축의 가장 상위 값을 바꿔준다
	
	g.set_x_labels(labels);
	g.set_data( data );
	
	g.title( "주간 접속 통계 ","{font-size: 15px;}" );
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%=g.render() %>
</body>
</html>